﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using uTorrentRemote.TokenSources;
using uTorrentRemote.TokenDispatchers;
using uTorrentRemote.TokenSources.Imap;
using System.Threading;

namespace uTorrentRemote
{
    class Program
    {
        static void Main(string[] args)
        {
            ILog log = new ConsoleLog();

            ITokenSource source = new ImapTokenSource(log);
            ITokenDispatcher dispatcher = new RuTrackerDownloadDispatcher(log);

            while (true)
            {
                while (source.IsNextTokenAvailable())
                {
                    Token token = source.FetchNextToken();
                    dispatcher.TryToken(token);
                }
                Thread.Sleep(10 * 1000);
            }
        }
    }
}
